/*
 * @Author: your name
 * @Date: 2020-12-21 15:52:04
 * @LastEditTime: 2021-01-13 11:05:01
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /wzry-auto-js/王者营地.js
 */

var click = require("_click.js");

click.init("王者营地app 脚本");

click.launchPackage("打开王者营地app并等待一段时间", "com.tencent.gamehelper.smoba");

//获取当前星期数
var week = "日一二三四五六".charAt(new Date().getDay());
click.log(week);
//不为周一 阅读1 分享1    否则 阅读5 点赞5 分享1
if(week != "一"){
    //进入阅读页
    click.findByUiObjer("android.view.ViewGroup","drawingOrder_click",[6,3],"click");
    //分享
    click.findByUiObjer("android.widget.LinearLayout","drawingOrder","10","click");
    //分享微信
    click.findByUiObjer("android.widget.LinearLayout","drawingOrder_click",[4,4],"click");
    //返回王者营地
    click.back_sleep();
    back();
}else{
    for (let index = 2; index < 7; index++) {
        click.log(index);
        //进入阅读页 
        click.findByUiObjer("android.view.ViewGroup","drawingOrder_click",[6,index],"click");
        //点赞
        click.findByUiObjer("android.widget.LinearLayout","drawingOrder","9","click");
        if (index == 2) {
            //分享
            click.findByUiObjer("android.widget.LinearLayout","drawingOrder","10","click");
            //分享微信
            click.findByUiObjer("android.widget.LinearLayout","drawingOrder_click",[4,4],"click");
            //返回-王者营地
            click.back_sleep();
            
            // click.sleep_log();
        }
        //返回-咨询
        click.back_sleep();
        // if(index == 4){
        //     click.swipe("下滑",552, 2110, 560, 1000,400);
        //     sleep(3000)
        // }
    }
}
//返回、等待加载
click.back_sleep();
//进入 战绩页
click.findByUiObjer("android.widget.RadioButton","text","战绩","click");
//启动游戏
click.findByUiObjer("android.view.ViewGroup","drawingOrder_click",[3,9],"click");
//打开 王者营地
launchPackage("com.tencent.gamehelper.smoba");
//额外等待
click.sleep_log();

//进入 我
click.findByUiObjer("android.widget.RadioButton","text","我","click");
//进入 每日福利
click.findByUiObjer("android.view.ViewGroup","drawingOrder_click",[4,1],"click");

//多等待一会
click.sleep_log();
click.findByUiObjer("android.widget.Button","text","立即签到","click");
click.findByUiObjer("android.widget.Button","text","确定","click");
click.swipe("下滑",552, 2110, 560, 1100,400);
//领取奖励  一次性领取所有
className("android.widget.Button").text("领取").find().click();
click.back_to_top("返回首页", 2, 3000);
click.exit_current_app("关闭APP");
